#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "game.h"
#include "gameview.h"

#include <QMainWindow>
#include <QPushButton>
#include <QLabel>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void saveGame();
    void loadGame();
    void showAbout();

protected:
    void resizeEvent(QResizeEvent *event) override;
    QSize sizeHint() const override { return QSize(518, 703); }

private slots:
    void onGameStateChanged(Game::State prev, Game::State next);
    void onGameUpdate();

private:
    Ui::MainWindow *ui;

    void initGame();
    void initUi();
    void initConnections();
    void setupInitialWidgets();
    void setSharedButtons();

    GameView *gameView;
    Game *game;

    QAction *actSave, *actLoad, *actQuit, *actAbout;
    QAction *actStart, *actRestart, *actPause, *actResume;

    QPushButton *btnLoad, *btnSave, *btnQuit;
    QPushButton *btnStartOrRestart, *btnPauseResume;

    QLabel *lblScore, *lblMovedDistance, *lblTime;

};
#endif // MAINWINDOW_H
